setfenv(1, require'winapi')
require'winapi.winuser'

ffi.cdef[[
HICON LoadIconW(
	  HINSTANCE hInstance,
	  LPCWSTR lpIconName);
]]

IDI_APPLICATION   = 32512
IDI_HAND          = 32513
IDI_QUESTION      = 32514
IDI_EXCLAMATION   = 32515
IDI_ASTERISK      = 32516
IDI_WINLOGO       = 32517
IDI_SHIELD        = 32518
IDI_WARNING       = IDI_EXCLAMATION
IDI_ERROR         = IDI_HAND
IDI_INFORMATION   = IDI_ASTERISK


function LoadIcon(hInstance, name)
	if not name then hInstance, name = nil, hInstance end
	return checkh(ffi.C.LoadIconW(hInstance, ffi.cast('LPCWSTR', wcs(name))))
end

if not ... then
print(LoadIcon(IDI_ASTERISK))
print(LoadIcon(IDI_HAND))
end

